Skip to content

feat: apitoken last characters option#62972

Merged
mdtro merged 2 commits intomasterfrom
mdtro/apitoken-last-chars
Jan 12, 2024
Merged

feat: apitoken last characters option#62972
mdtro merged 2 commits intomasterfrom
mdtro/apitoken-last-chars

Conversation

@mdtro
Copy link
Contributor

@mdtro mdtro commented Jan 10, 2024

Take two of #59455.

  • Add an option to toggle on/off automatically populating the token_last_characters for the ApiToken model.

This option will ensure tokens created from here on have the field populated. It will also allow me to thoroughly test the backfill migration needed for existing tokens that will be coming in a future PR by disabling the option in tests, creating a bunch of API tokens, and then running the backfill migration test.

Tracking Issue: #58918
RFC: getsentry/rfcs#32

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 10, 2024
@codecov
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (070f66c) 81.35% compared to head (896c609) 81.35%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #62972      +/-   ##
==========================================
- Coverage   81.35%   81.35%   -0.01%     
==========================================
  Files        5203     5203              
  Lines      230613   230620       +7     
  Branches    39847    39848       +1     
==========================================
- Hits       187615   187614       -1     
- Misses      37248    37254       +6     
- Partials     5750     5752       +2     
Files Coverage Δ
src/sentry/backup/comparators.py 94.72% <ø> (ø)
src/sentry/models/apitoken.py 99.04% <100.00%> (+0.05%) ⬆️
src/sentry/options/defaults.py 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

@mdtro mdtro marked this pull request as ready for review January 10, 2024 22:28
@mdtro mdtro requested a review from a team January 10, 2024 22:28
@azaslavsky azaslavsky self-requested a review January 11, 2024 22:17
@mdtro mdtro merged commit 247b603 into master Jan 12, 2024
@mdtro mdtro deleted the mdtro/apitoken-last-chars branch January 12, 2024 23:02
@sentry
Copy link
Contributor

sentry bot commented Jan 16, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ OutboxFlushError: Could not flush shard category=32 (API_TOKEN_UPDATE) pytest.runtest.protocol tests/sentry/api/endpoi... View Issue
  • ‼️ OutboxFlushError: Could not flush shard category=32 (API_TOKEN_UPDATE) pytest.runtest.protocol tests/sentry/mediators/... View Issue

Did you find this useful? React with a 👍 or 👎

mdtro added a commit that referenced this pull request Jan 17, 2024
Backfills the `token_last_characters` column on existing `ApiToken` entries.

As of #62972, new `ApiToken` entries
are being created with this column already populated with the correct
values. This backfill will only impact old tokens created prior.

Tracking Issue: #58918
Related RFC: getsentry/rfcs#32
trillville pushed a commit that referenced this pull request Jan 19, 2024
Take two of #59455.

- Add an option to toggle on/off automatically populating the
`token_last_characters` for the `ApiToken` model.

This option will ensure tokens created from here on have the field
populated. It will also allow me to thoroughly test the backfill
migration needed for existing tokens that will be coming in a future PR
by disabling the option in tests, creating a bunch of API tokens, and
then running the backfill migration test.

Tracking Issue: #58918
RFC: getsentry/rfcs#32
trillville pushed a commit that referenced this pull request Jan 19, 2024
Backfills the `token_last_characters` column on existing `ApiToken` entries.

As of #62972, new `ApiToken` entries
are being created with this column already populated with the correct
values. This backfill will only impact old tokens created prior.

Tracking Issue: #58918
Related RFC: getsentry/rfcs#32
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2024
@mdtro mdtro linked an issue Feb 2, 2024 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add name and token_last_characters to ApiToken

2 participants